﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using CMP.ERP.Helper;
using CMP.ERP.Model;
using System.Configuration;
using System.Data.SqlClient;

namespace CMP.ERP.DAL
{
    public class LocalityDAL
    {
        SQLHelper helper = new SQLHelper();

        /// <summary>
        /// 获取第一级地区信息
        /// </summary>
        /// <param name="provice"></param>
        /// <returns></returns>
        public DataTable GetLocality(string provice)
        {
            string sql = "proc_GetLocality";
            SqlParameter[] commLocality = new SqlParameter[]
            {
                new SqlParameter ("@Locality_did",provice),
            };
            return helper.ExecDataTable_Proc(sql, commLocality);

        }
        /// <summary>
        /// 添加地区信息
        /// </summary>
        /// <param name="l"></param>
        /// <returns></returns>
        public int AddLocality(Province l)
        {
            string ProcName = "proc_AddLocality";
            SqlParameter[] commlocality = new SqlParameter[]
            {
                new SqlParameter("@Locality_sheng",l.P_Name),
                new SqlParameter("@Locality_did",l.P_City)
            };
            return helper.ExecNonquery_Proc(ProcName, commlocality);
        }
    }
}
